print("继承和多态##################################################start")


class Animal(object):
    def run(self):
        print('Animal is running...')


class Dog(Animal):
    pass


class Cat(Animal):
    pass


dog = Dog()
cat = Cat()
dog.run()
cat.run()


class Dog2(Animal):
    def run(self):
        print('Dog is running...')


class Cat2(Animal):
    def run(self):
        print('Cat is running...')


dog = Dog2()
cat = Cat2()
dog.run()
cat.run()

print(isinstance(dog, Animal))
print(isinstance(cat, Animal))
a = Animal
print(isinstance(a, Dog2))

# 接受Animal类型的函数
def run_twice(animal):
    animal.run()


run_twice(Dog2())
run_twice(Cat2())

print("继承和多态##################################################end\n")
